package com.kly.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kly.domain.dto.user.UserFollowRequest;
import com.kly.domain.dto.user.UserLoginBySmsRequest;
import com.kly.domain.dto.user.UserQueryRequest;
import com.kly.domain.entity.User;
import com.kly.domain.vo.LoginUserVo;
import com.kly.domain.vo.PictureVO;
import com.kly.domain.vo.ScrollResult;
import com.kly.domain.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author admin
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-03-02 18:28:08
*/
public interface UserService extends IService<User> {


    /**
     * 用户注册
     * @param userAccount
     * @param userPassword
     * @param checkPassword
     * @return
     */
    Long userRegister(String userAccount, String userPassword, String checkPassword);


    /**
     * 获取加密后的密码
     * @param userPassword
     * @return
     */
    String getEncryptedPassword(String userPassword);

    /**
     * 用户登录
     *
     * @param userAccount
     * @param userPassword
     * @param request
     * @return
     */
    String userLogin(String userAccount, String userPassword, HttpServletRequest request);


    /**
     * 获取脱敏的登录用户信息
     * @param userDb
     * @return
     */
    LoginUserVo getLoginUserVo(User userDb);


    /**
     * 获取用户脱敏信息
     */
    UserVO getUserVo(User user);

    /**
     * 批量获取用户脱敏信息
     */
    List<UserVO> getUserVoList(List<User> userList);


    /**
     * 获取查询条件
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    /**
     * 获取当前用户信息
     */
    User getLoginUser(HttpServletRequest request);


    /**
     * 用户注销
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 关注用户
     * @param userFollowRequest
     * @param loginUser
     * @return
     */
    boolean followUser(UserFollowRequest userFollowRequest, User loginUser);

    /**
     * 查询共同关注用户
     * @param followedUserId
     * @param userId
     * @return
     */
    List<User> commonFollowUser(Long followedUserId, Long userId);


    /**
     * 查询关注列表
     *
     * @param max
     * @param offset
     * @param userId
     * @return
     */
    ScrollResult<PictureVO> queryFollowList(Long max, Integer offset, Long userId);


    /**
     * 用户登录 通过短信
     *
     * @param userLoginBySmsRequest
     * @return
     */
    String userLoginBySms(UserLoginBySmsRequest userLoginBySmsRequest);

    /**
     * 发送验证码
     */
    void sendCode(String phone);

    /**
     * 发送验证码
     * @param email
     * @return
     */
    void sendCodeByEmail(String email);

    /**
     * 用户登录 通过邮箱
     *
     * @param userLoginBySmsRequest
     * @param request
     * @return
     */
    LoginUserVo userLoginByEmail(UserLoginBySmsRequest userLoginBySmsRequest, HttpServletRequest request);


    /**
     * 校验邮箱格式
     */
    void checkEmail(String email);
}
